<template>
<div class="card">
    <div>
        <el-row style="height:40px;margin:10px 0" v-show="userinfo.name">
            <el-col :span="4" :push="1">
                <h2>欢迎你：{{userinfo.name}}{{companyUser.position.name}}</h2>
            </el-col>
            <el-col :span="3">
                <div class="demo-image">
                    <div class="block">
                        <el-image style="width: 50px; height: 50px" :src="URL" :fit="fill"></el-image>
                    </div>
                </div>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="12">
                <el-card class="box-card">
                    <div slot="header" class="clearfix">
                        <span>官网简介--</span>
                    </div>
                    <div v-for="o in 4" :key="o" class="text item">
                        {{'列表内容 ' + o }}
                    </div>
                </el-card>
            </el-col>
            <el-col :span="12">
                <el-card class="img-card">
                    <img src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png" class="image">
                    <div style="padding: 14px;">
                        <span>最专业的企业日程</span>
                    </div>
                </el-card>
            </el-col>
        </el-row>
    </div>
</div>
</template>

<script>
import instance from "@/utlis/request.js";
import instanceToken from "@/utlis/tokenIdentify.js";
export default {
    name: 'Index',
    components: {},
    data() {
        return {
            userinfo: {name:'',headerPic:''},
            companyUser: {
                position: {
                    name:''
                }
            },
            URL:'',
        };
    },
    computed: {},
    watch: {},
    methods: {},
    created() {
        //进入组件获取此人员信息
        instanceToken.get("/userinfo/showIndex").then(res => {
            // console.log(window.sessionStorage.getItem("token"));
            console.log("进入index组件created")
            this.userinfo = JSON.parse(JSON.stringify(res.data.data.userinfo));
            this.companyUser = JSON.parse(JSON.stringify(res.data.data.companyUser));
            window.sessionStorage.setItem("companyUser",JSON.stringify(this.companyUser));
            this.URL = "http://localhost:8989/static/uploadFiles/headerPics/"+this.userinfo.headerPic;
            console.log("index");
            console.log(res.data)
            console.log(this.URL)
        })
    },
}
</script>

<style scoped>
.box-card {
    margin-top: 20px;
    margin-left: 80px;
}

.img-card {
    width: 400px;
    height: 400px;
    margin-top: 50px;
    margin-left: 100px;
}
</style>
